package com.diandiansong.app.entity;

import com.google.gson.annotations.SerializedName;

import java.util.List;

import diandiansong.library.utils.BaseEntity;

public class CommodityKillInfo extends BaseEntity {

    /**
     * message : null
     * data : {"kill_time":"68756","kill_end_time":"23","list_info":[{"id":"4","commodity_id":"9","commodity_name":"金针菇",
     * "imgs":"http://h3.mobilekoudai.com/uploads/2018-07-26/45e9ce45d9b1805767a3c3f0e67e54aa43.jpg","kill_price":"0.04","unit":"斤","stock":"0",
     * "commodity_subtitle":"一夜成长","price":"0.01","spec_info":[{"product_id":"8","kill_price":"0.04","store":"123","spec_info":"1斤，2斤，3斤，",
     * "price":"0.01"}],"title_sku":"1斤，2斤，3斤，"},{"id":"3","commodity_id":"18","commodity_name":"枣","imgs":"http://h3.mobilekoudai
     * .com/uploads/2018-07-26/f5748a6723dae5b63a3269223d783e1e78.jpg","kill_price":"0.02","unit":"斤","stock":"578","commodity_subtitle":"老甜老甜了",
     * "price":"0.01","spec_info":[],"title_sku":""},{"id":"2","commodity_id":"20","commodity_name":"牛肉","imgs":"http://h3.mobilekoudai
     * .com/uploads/2018-07-26/9f548e168c38e9f0dc3679f21b1f46bab8.jpg","kill_price":"0.01","unit":"斤","stock":"345","commodity_subtitle":"放生牛，土家牛",
     * "price":"888.00","spec_info":[],"title_sku":""},{"id":"1","commodity_id":"7","commodity_name":"小青菜","imgs":"http://h3.mobilekoudai
     * .com/uploads/2018-07-26/9ee8e982a89b48308645a3770b693cac94.jpg","kill_price":"0.01","unit":"斤","stock":"1233","commodity_subtitle":"很青的青菜",
     * "price":"0.01","spec_info":[{"product_id":"6","kill_price":"0.01","store":"1233","spec_info":"1斤，2斤，3斤，","price":"0.01"}],
     * "title_sku":"1斤，2斤，3斤，"}]}
     */

    @SerializedName("data")
    private Data data;

    public Data getData() {
        return data;
    }

    public void setData(Data data) {
        this.data = data;
    }

    public static class Data {
        /**
         * kill_time : 68756
         * kill_end_time : 23
         * list_info : [{"id":"4","commodity_id":"9","commodity_name":"金针菇","imgs":"http://h3.mobilekoudai
         * .com/uploads/2018-07-26/45e9ce45d9b1805767a3c3f0e67e54aa43.jpg","kill_price":"0.04","unit":"斤","stock":"0","commodity_subtitle":"一夜成长",
         * "price":"0.01","spec_info":[{"product_id":"8","kill_price":"0.04","store":"123","spec_info":"1斤，2斤，3斤，","price":"0.01"}],
         * "title_sku":"1斤，2斤，3斤，"},{"id":"3","commodity_id":"18","commodity_name":"枣","imgs":"http://h3.mobilekoudai
         * .com/uploads/2018-07-26/f5748a6723dae5b63a3269223d783e1e78.jpg","kill_price":"0.02","unit":"斤","stock":"578",
         * "commodity_subtitle":"老甜老甜了","price":"0.01","spec_info":[],"title_sku":""},{"id":"2","commodity_id":"20","commodity_name":"牛肉",
         * "imgs":"http://h3.mobilekoudai.com/uploads/2018-07-26/9f548e168c38e9f0dc3679f21b1f46bab8.jpg","kill_price":"0.01","unit":"斤",
         * "stock":"345","commodity_subtitle":"放生牛，土家牛","price":"888.00","spec_info":[],"title_sku":""},{"id":"1","commodity_id":"7",
         * "commodity_name":"小青菜","imgs":"http://h3.mobilekoudai.com/uploads/2018-07-26/9ee8e982a89b48308645a3770b693cac94.jpg",
         * "kill_price":"0.01","unit":"斤","stock":"1233","commodity_subtitle":"很青的青菜","price":"0.01","spec_info":[{"product_id":"6",
         * "kill_price":"0.01","store":"1233","spec_info":"1斤，2斤，3斤，","price":"0.01"}],"title_sku":"1斤，2斤，3斤，"}]
         */

        @SerializedName("kill_time")
        private String killTime;
        @SerializedName("kill_end_time")
        private String killEndTime;
        @SerializedName("list_info")
        private List<ListInfo> listInfo;

        public boolean isEnable() {
            try {
                return killTime != null && Long.valueOf(killTime) > 0;
            } catch (Exception e) {
                e.printStackTrace();
            }
            return false;
        }

        public String getKillTime() {
            return killTime;
        }

        public void setKillTime(String killTime) {
            this.killTime = killTime;
        }

        public String getKillEndTime() {
            return killEndTime;
        }

        public void setKillEndTime(String killEndTime) {
            this.killEndTime = killEndTime;
        }

        public List<ListInfo> getListInfo() {
            return listInfo;
        }

        public void setListInfo(List<ListInfo> listInfo) {
            this.listInfo = listInfo;
        }

        public static class ListInfo {
            /**
             * id : 4
             * commodity_id : 9
             * commodity_name : 金针菇
             * imgs : http://h3.mobilekoudai.com/uploads/2018-07-26/45e9ce45d9b1805767a3c3f0e67e54aa43.jpg
             * kill_price : 0.04
             * unit : 斤
             * stock : 0
             * commodity_subtitle : 一夜成长
             * price : 0.01
             * spec_info : [{"product_id":"8","kill_price":"0.04","store":"123","spec_info":"1斤，2斤，3斤，","price":"0.01"}]
             * title_sku : 1斤，2斤，3斤，
             */

            @SerializedName("id")
            private String id;
            @SerializedName("commodity_id")
            private String commodityId;
            @SerializedName("commodity_name")
            private String commodityName;
            @SerializedName("imgs")
            private String imgs;
            @SerializedName("kill_price")
            private String killPrice;
            @SerializedName("unit")
            private String unit;
            @SerializedName("stock")
            private String stock;
            @SerializedName("commodity_subtitle")
            private String commoditySubtitle;
            @SerializedName("price")
            private String price;
            @SerializedName("title_sku")
            private String titleSku;
            @SerializedName("spec_info")
            private List<SpecInfo> specInfo;


            @SerializedName("tourist")
            private String tourist;

            public boolean isTourist() {
                return tourist != null && tourist.equals("1");
            }

            public String getId() {
                return id;
            }

            public void setId(String id) {
                this.id = id;
            }

            public String getCommodityId() {
                return commodityId;
            }

            public void setCommodityId(String commodityId) {
                this.commodityId = commodityId;
            }

            public String getCommodityName() {
                return commodityName;
            }

            public void setCommodityName(String commodityName) {
                this.commodityName = commodityName;
            }

            public String getImgs() {
                return imgs;
            }

            public void setImgs(String imgs) {
                this.imgs = imgs;
            }

            public String getKillPrice() {
                if (isTourist()) {
                    //return "--";
                    return "";
                }
                return killPrice;
            }

            public void setKillPrice(String killPrice) {
                this.killPrice = killPrice;
            }

            public String getUnit() {
                if (unit == null || unit.isEmpty() || unit.equals("/")) {
                    unit = "";
                } else {
                    unit = "/" + unit;
                }
                return unit;
            }

            public void setUnit(String unit) {
                this.unit = unit;
            }

            public String getStock() {
                return stock;
            }

            public void setStock(String stock) {
                this.stock = stock;
            }

            public String getCommoditySubtitle() {
                return commoditySubtitle;
            }

            public void setCommoditySubtitle(String commoditySubtitle) {
                this.commoditySubtitle = commoditySubtitle;
            }

            public String getPrice() {
                if (isTourist()) {
                    //return "--";
                    return "";
                }
                return price;
            }

            public void setPrice(String price) {
                this.price = price;
            }

            public String getTitleSku() {
                return titleSku;
            }

            public void setTitleSku(String titleSku) {
                this.titleSku = titleSku;
            }

            public List<SpecInfo> getSpecInfo() {
                return specInfo;
            }

            public void setSpecInfo(List<SpecInfo> specInfo) {
                this.specInfo = specInfo;
            }

            public static class SpecInfo {
                /**
                 * product_id : 8
                 * kill_price : 0.04
                 * store : 123
                 * spec_info : 1斤，2斤，3斤，
                 * price : 0.01
                 */

                @SerializedName("product_id")
                private String productId;
                @SerializedName("kill_price")
                private String killPrice;
                @SerializedName("store")
                private String store;
                @SerializedName("spec_info")
                private String specInfo;
                @SerializedName("price")
                private String price;

                public String getProductId() {
                    return productId;
                }

                public void setProductId(String productId) {
                    this.productId = productId;
                }

                public String getKillPrice() {
                    return killPrice;
                }

                public void setKillPrice(String killPrice) {
                    this.killPrice = killPrice;
                }

                public String getStore() {
                    return store;
                }

                public void setStore(String store) {
                    this.store = store;
                }

                public String getSpecInfo() {
                    return specInfo;
                }

                public void setSpecInfo(String specInfo) {
                    this.specInfo = specInfo;
                }

                public String getPrice() {
                    return price;
                }

                public void setPrice(String price) {
                    this.price = price;
                }
            }
        }
    }
}
